<?php
require_once(dirname(__FILE__).'/../../../uc/models/relation/UCModRelation.php');
require_once(dirname(__FILE__).'/../../../uc/libraries/UCLibLogger.php');
/**
* 好友关系的相关操作
*/
class OPModRelation extends UCModRelation
{
    protected function _isSuccess($ret)
    {
        $this->_errno = (is_array($ret) && array_key_exists('code', $ret))? $ret['code']:-1;
        $this->_error = (is_array($ret) && array_key_exists('msg', $ret))? $ret['msg']:'';
        return (is_array($ret) && $ret['status']==200 && $ret['code'] == 0)? true:false;
    }

    public function addRelation($target_userid,$appId=0, $appName = '')
    {
		//appName 产生关系的app 名字
		//appId  产生关系的 app 内部编号，若无传入 0
		$allow_param = array(
			"appName" =>$appName
			,"appId" =>$appId
			,"remarks" => '');
//		$app_id	= 0;

        $ret = SDOApiRelationService::addRelation($this->_userid, $target_userid, $allow_param);
        return $this->_isSuccess($ret);
    }

}


//$o = new OPModRelation(110000308490);
////$ret = $o->getPersonGroups();
//$ret = $o->addRelation(2);
//var_dump($ret);
//var_dump($o->_errno);
